Conversation
This reverts commit ab8f67a.
Contributor
There was a problem hiding this comment.
Pull Request Overview
Adds support for HTTP 404 responses by decoding CouchDB error payloads into a new notFound client error, updates localization, and adjusts tests.
- Introduce
CouchDBClientError.notFound(error:)and handle 404 inCouchDBClient. - Extend
LocalizedErrorconformance and addNOT_FOUND_ERRORtranslations. - Update
test14_get_document_not_foundto expect the new error.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Tests/CouchDBClientTests/CouchDBClientTests.swift | Updated test14_get_document_not_found to catch CouchDBClientError.notFound error |
| Sources/CouchDBClient/Models/CouchDBClientError.swift | Added .notFound case and localized messages in the error enum |
| Sources/CouchDBClient/CouchDBClient.swift | Handle .notFound status by decoding body into CouchDBError and throwing .notFound |
| Sources/CouchDBClient/Localizable.xcstrings | Removed duplicate conflict‐error entry and added translations for NOT_FOUND_ERROR |
Comments suppressed due to low confidence (2)
Tests/CouchDBClientTests/CouchDBClientTests.swift:403
- Add an assertion inside this catch to verify that the embedded
CouchDBErrorcontains the expected server error details (e.g., reason or status) so the test validates the decoding logic.
} catch CouchDBClientError.notFound(_) {
Sources/CouchDBClient/Models/CouchDBClientError.swift:171
- This
case .notFoundin the second localization switch duplicates an existing case label and will cause a compile-time error. Remove the redundant block.
case .notFound:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog for 2.2.0
This release focuses on improved error handling for "not found" cases and updates to related tests.
🛠 Improvements
Enhanced Not Found Error Handling
getmethods throughout the client now return a new, explicitnotFounderror when a requested document or resource does not exist.Upgrade Notes:
If you rely on catching missing-document errors, update your error handling to use the new
notFoundcase for more granular control.Thank you for using couchdb-swift!